#ifndef NETWORKLIST_H
#define NETWORKLIST_H

#include <QObject>
#include <QString>
#include <QMap>
#include <QHostInfo>
#include <QHostAddress>
#include <QNetworkInterface>
#include <QNetworkAddressEntry>

#include "networkthread.h"
#include "hostlist.h"






namespace Moolink {


        class NetWorkList : public QObject
        {
        public:

            NetWorkList(QObject *parent = nullptr);
            ~NetWorkList();

//            QStringList SerialRefresh();
            void queryHostInfoInDb();
            void writeDataToNetWork(int hostindex,QString hostname,QString hostip,int hostport,int waitMSEC,QString datastr);
            void writeDataToHost(int hostindex,Host host,int waitMSEC,QString datastr);
            void getLocalHostInfo();

            // 设置回调函数的函数
            void setCallbackFunc(void(*func) (int hostIndex,QString hostName,QString res,int error));

        private:
                void(*m_callbackFunc)(int hostIndex,QString hostName,QString res,int error);
//        signals:
//            void response(const QString &s);
//            void error(const QString &s);
//            void timeout(const QString &s);
        private slots:
//            void transaction();
            void showRequest(int hostIndex,const QString &hostName,const QString &res);
            void processError(int hostIndex,const QString &hostName,const QString &res);
//            void processTimeout(const QString &s);
        };
}
#endif // NETWORKLIST_H
